package com.zhl.emp_manage.mapper;

import com.zhl.emp_manage.entity.Meeting;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface MeetingMapper {
    //查看所有会议
    @Select("select * from meeting")
    List<Meeting> getList();

    //根据id查询会议
    @Select("select * from meeting where id=#{id}")
    Meeting getOne(Integer id);

    //添加会议
    @Insert("insert into meeting (meeting_name,meeting_createtime,meeting_location,meeting_num,meeting_creater) values (#{meetingName},#{meetingCreatetime},#{meetingLocation},#{meetingNum},#{meetingCreater})")
    boolean addMeeting(Meeting meeting);

    //根据id删除会议
    @Delete("delete from meeting where id=#{id}")
    boolean deleteMeeting(Integer id);

    //根据会议名称模糊查询
    @Select("select * from meeting where meeting_name like CONCAT('%',#{meetingName},'%') ")
    List<Meeting> getListLike(String name);

    //修改会议
    @Update("update meeting set meeting_name=#{meetingName},meeting_createtime=#{meetingCreatetime},meeting_location=#{meetingLocation},meeting_num=#{meetingNum},meeting_creater=#{meetingCreater} where id=#{id}")
    boolean updateMeeting(Meeting meeting);

    //分页查询
    List<Meeting> getMeetingMore(Integer page, Integer limit);
}
